


import random
class Person:
    def __init__(self,name,money):
        self.name=name
        self.money=money

    def show(self):
        print(f"我是{self.name},目前有{self.name}块钱")
class Manager(Person):
    def send(self,money,num):
        if self.money<money:
            print("逗你玩")
            return None
        red_list=[]
        self.money-=money
        avg=money//num
        rest=money%num
        for i in range(num):
            red_list.append(avg)
        red_list[-1]+=rest
        return red_list
class Member(Person):
    def grab(self,red_list):
        '''
        成员负责抢红包，抢到的红包存到自己的账户里
        :param rest_list:
        :return:
        '''
        if not red_list:
            print("一毛钱不给")
            return  None
        random_index=random.randint(0,(len(red_list)-1))
        luck_money=red_list.pop(random_index)
        self.money+=luck_money

if __name__ == '__main__':
    manger=Manager("我",10)
    reds = manger.send(100, 3)

    zhuang = Member("壮壮", 0)
    zhuang.grab(reds)

    sun_xiao = Member("孙小", 0)
    sun_xiao.grab(reds)

